<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .red {
            width: 100px;
            height: 100px;
            background-color: red;
        }

        .green {
            width: 100px;
            height: 100px;
            background-color: green;
        }

        .blue {
            width: 100px;
            height: 100px;
            background-color: blue;
        }

        .pink {
            width: 100px;
            height: 100px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div class="red"></div>
    <div class="green"></div>
    <div class="blue"></div>
    <div class="pink"></div>
</body>
<script>
    const pink = document.querySelector(".pink");
    const blue = document.querySelector('.blue');
    function fn()
    {
        alert('正在点击pink盒子');
    }
    pink.addEventListener('click',fn);
    blue.addEventListener('click',function(){
        alert('pink盒子已解除绑定');
        pink.removeEventListener('click',fn);
    });
</script>

</html>